#ifndef __NATSUME_Configuration_h__
#define __NATSUME_Configuration_h__

#include <iostream>
#include <map>
#include <set>
#include <string>


// 宏定义结构体
struct InforArgs {
    // 配置文件路径
        const std::string           CONFIG_PATH = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/conf/setting.conf";
    // 停用词集路径
        // 英文停用词集路径
        const std::string       EN_STOP_WORD_PATH = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/data/stopwords/en_stopwords.txt";
        // 中文停用词集路径
        const std::string       CN_STOP_WORD_PATH = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/data/stopwords/cn_stopwords.txt";

    // CppJieba 相应的宏
        // 最大概率法(MPSegment: MAX Probability) 分词所使用的词典路径
        const std::string  DICT_PATH        = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/KeyRecommander/cppjieba/dict/jieba.dict.utf8";
        // 隐式马尔科夫模型(HMMSegment: Hidden Markov Model) 分词所使用的词典路径
        const std::string  HMM_PATH         = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/KeyRecommander/cppjieba/dict/hmm_model.utf8";
        // 用户自定义词典路径
        const std::string  USER_DICT_PATH   = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/KeyRecommander/cppjieba/dict/user.dict.utf8";
        // IDF路径
        const std::string  IDF_PATH         = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/KeyRecommander/cppjieba/dict/idf.utf8";
        // 停用词词集路径
        const std::string  STOP_WORD_PATH   = "/home/ubuntu/Documents/Github/Book/SearchEngine_demo/KeyRecommander/cppjieba/dict/stop_words.utf8";
};


// 配置文件类
class Configuration {
    public:
        // 构造函数
        Configuration(const std::string  & filePath);
        // 析构函数
        ~Configuration();
    
    public:
        // 获取配置文件内容
        std::map<std::string, std::string> & 
        getConfigMap();
        // 获取中文停用词词集
        std::set<std::string> &
        getCN_StopWordList();
        // 获取英文停用词词集
        std::set<std::string> &
        getEN_StopWordList();
    
    private:
        // 初始化配置文件内容
        void initConfigMap();
        // 初始化中文停用词词集
        void initCN_StopWordList();
        // 初始化英文停用词词集
        void initEN_StopWordList();
    
    private:
        // 配置文件路径 /home/ubuntu/Documents/Github/Book/SearchEngine_demo/conf/setting.conf
        std::string                         m_filePath;
        // 配置文件内容
        std::map<std::string, std::string>
                                            m_configMap;
        // 中文停用词词集
        std::set<std::string>               m_cn_stopWordList;
        // 英文停用词词集
        std::set<std::string>               m_en_stopWordList;
        // 基本数据的宏信息结构体
        InforArgs                           m_inforArgs;
};


// 调试函数
template <typename Coll>
void PRINT_ELEMENT(const Coll &coll) {
    for (const auto & elem : coll)
        std::cout << "[value]:\t" << elem << std::endl;

    std::cout << std::endl;
}

template <typename Coll>
void PRINT_ELEMENTS(const Coll &coll) {
    for (const auto & it : coll)
        std::cout << "[key]:\t" << it.first << "\t[value]:\t" << it.second << std::endl;

    std::cout << std::endl;
}

#endif // __NATSUME_Configuration_h__
